import unittest

from com.yhzy.demo.unittest_demo_01 import TestDemo
from com.yhzy.demo.unittest_demo_02 import TestUser

if __name__ == '__main__':
    # 创建单元测试套件对象
    testsuit = unittest.TestSuite()
    # 加载单元测试类 testcase
    testsuit.addTest(unittest.TestLoader().loadTestsFromTestCase(TestDemo))
    testsuit.addTest(unittest.TestLoader().loadTestsFromTestCase(TestUser))
    # 定义测试报告文件
    report = open("report.txt",mode="w")
    # 运行器运行测试套件
    runner = unittest.TextTestRunner(stream=report,verbosity=2)
    runner.run(testsuit)